/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: happyiu
 * Date: 2021-11-22
 * Time: 20:23
 */
class Animal {
    public String name = "hello";
    public int age;
    protected int count;

    public Animal(String name,int age) {
        this.name = name;
        this.age = age;
    }

    public void eat() {
        System.out.println(name+"eat()");
        System.out.println(count);
    }
}

class Dog extends Animal{
    /*  public Dog() {
          super();
      }*/
    public Dog(String name,int age) {
        super(name,age);
    }

    public void eat(){
        System.out.println(name+"正在狼吞虎咽的eat()");
    }
}

class Bird extends Animal{
    public String wing;
    public String name;//null

    public Bird(String name,int age,String wing) {
        super(name,age);
        this.wing = wing;
    }

    public void fly() {
        System.out.println(super.name+"fly()"+age);
    }
}

public class TestDemo {

    public  static  Animal func2(){
        Dog dog = new Dog("haha",19);
        return dog;
    }


    public static void func(Animal animal){

    }

    /*public static void main(String[] args) {
        Animal animal2 = new Bird("www",29,"我会飞啊");
        Bird bird = (Bird)animal2;
        bird.fly();

    }*/

    public static void main(String[] args) {
        Animal animal2 = new Dog("www",19);
        Bird bird = (Bird)animal2;
        bird.fly();
    }

    /*public static void main(String[] args) {
        Dog dog = new Dog("haha",19);
        Animal animal = dog;
        animal.eat();

    }*/

    public int val = 10;
    protected int val2 = 99;

    public static void main3(String[] args) {
        Bird bird = new Bird("heihei",18,"我要的飞翔");
        System.out.println(bird.count);
    }

    public static void main2(String[] args) {
        Bird bird = new Bird("heihei",18,"我要的飞翔");
        System.out.println(bird.name);
        bird.fly();
    }

    public static void main1(String[] args) {
        Dog dog = new Dog("haha",19);
        System.out.println(dog.name);
        dog.eat();

        Bird bird = new Bird("heihei",18,"我要的飞翔");
        System.out.println(bird.name);
        bird.eat();
        bird.fly();
    }

}
